<?
	use_db_wordpress();

	$query = mysql_query("SELECT * FROM `$wp_links`");
	while($row = mysql_fetch_array($query)) { /* Move the Links */
		$id = "";
		$name = "";
		$url = "";
		$owner = "";
		$added = "";
		$category = "";
	
		$name = $row['link_name'];
		$url = $row['link_url'];
		$owner = $row['link_owner'];
		$added = strtotime($row['link_updated']);
		$category = $row['link_category'];

		$link_query = mysql_query("SELECT * FROM `$wp_linkcategories` WHERE `cat_id`='$category'");
		while($row = mysql_fetch_array($link_query)) {
			$tag = "";
			$tag = $row['cat_name'];
		}

		drizzo_db_connect();

		$drizzo_insert = "INSERT INTO `$drizzo_links` (`ID`, `name`, `url`, `owner`, `added`, `tags`) VALUES ('', '$name', '$url', '$owner', '$added', '$tag')";

		$insert_check = mysql_query($drizzo_insert);
		if($insert_check) {
		} else {
			echo mysql_error();
		}
		
		use_db_wordpress();

	}
	
	echo "<p>" . mysql_num_rows($query) . " links have been imported.</p>";
?>